﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace devtm.Documentation.CSharpModel
{


    public static class CSharpUsageMetrics
    {
        // Fields
        private static EventHandler<MetadataViewAttemptEventArgs> _MetadataViewAttempted;

        // Events
        public static event EventHandler<MetadataViewAttemptEventArgs> MetadataViewAttempted
        {
            add
            {
                EventHandler<MetadataViewAttemptEventArgs> handler2;
                EventHandler<MetadataViewAttemptEventArgs> metadataViewAttempted = _MetadataViewAttempted;
                do
                {
                    handler2 = metadataViewAttempted;
                    EventHandler<MetadataViewAttemptEventArgs> handler3 = (EventHandler<MetadataViewAttemptEventArgs>)Delegate.Combine(handler2, value);
                    metadataViewAttempted = Interlocked.CompareExchange<EventHandler<MetadataViewAttemptEventArgs>>(ref _MetadataViewAttempted, handler3, handler2);
                }
                while (metadataViewAttempted != handler2);
            }
            remove
            {
                EventHandler<MetadataViewAttemptEventArgs> handler2;
                EventHandler<MetadataViewAttemptEventArgs> metadataViewAttempted = _MetadataViewAttempted;
                do
                {
                    handler2 = metadataViewAttempted;
                    EventHandler<MetadataViewAttemptEventArgs> handler3 = (EventHandler<MetadataViewAttemptEventArgs>)Delegate.Remove(handler2, value);
                    metadataViewAttempted = Interlocked.CompareExchange<EventHandler<MetadataViewAttemptEventArgs>>(ref _MetadataViewAttempted, handler3, handler2);
                }
                while (metadataViewAttempted != handler2);
            }
        }

        // Methods
        public static void RaiseMetadataViewAttempted(object item)
        {
            EventHandler<MetadataViewAttemptEventArgs> metadataViewAttempted = _MetadataViewAttempted;
            if (metadataViewAttempted != null)
            {
                metadataViewAttempted(null, new MetadataViewAttemptEventArgs(item));
            }
        }

        // Nested Types
        public class MetadataViewAttemptEventArgs : EventArgs
        {
            // Methods
            public MetadataViewAttemptEventArgs(object item)
            {
                this.Item = item;
            }

            // Properties
            public object Item { get; private set; }
        }
    }



}
